import { IsNotEmpty, IsNumber, IsOptional, MaxLength } from 'class-validator'
import i18n, { i18nMessage } from '@/i18n'
import { ApiProperty } from '@nestjs/swagger'

export class FlowFileUpdateDto {
  @ApiProperty({ description: 'ID' })
  @IsNotEmpty()
  @IsNumber()
  id: number

  @ApiProperty({ description: '文件名称' })
  @MaxLength(64, { message: i18nMessage() })
  @IsNotEmpty()
  label: string

  @ApiProperty({ description: 'URL地址', type: String })
  @MaxLength(256, { message: i18nMessage() })
  @IsNotEmpty()
  url: string

  @ApiProperty({ description: '分组名称' })
  @IsNotEmpty()
  @MaxLength(64, { message: i18nMessage() })
  groupLabel: string

  @ApiProperty({ description: '序号' })
  @IsNumber()
  @IsOptional()
  sortNo?: number
}
